<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>NAS 服务访问中心</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body { 
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; 
            line-height: 1.6;
            color: #333;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            padding: 20px;
        }
        
        .container {
            max-width: 1000px;
            margin: 0 auto;
            background: rgba(255, 255, 255, 0.95);
            border-radius: 15px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
            overflow: hidden;
        }
        
        .header {
            background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
            color: white;
            padding: 30px;
            text-align: center;
        }
        
        .header h1 {
            font-size: 2.2em;
            margin-bottom: 10px;
        }
        
        .header p {
            opacity: 0.9;
            font-size: 1.1em;
        }
        
        .ip-display {
            background: #e8f4ff;
            padding: 20px;
            text-align: center;
            border-bottom: 3px solid #007bff;
        }
        
        .ip-display .label {
            font-size: 1.1em;
            color: #666;
            margin-bottom: 5px;
        }
        
        .ip-display .ip {
            font-size: 1.8em;
            font-weight: bold;
            color: #007bff;
            font-family: 'Courier New', monospace;
        }
        
        .services-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
            gap: 20px;
            padding: 30px;
        }
        
        .service-card {
            background: white;
            border-radius: 10px;
            padding: 25px;
            text-align: center;
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
            transition: all 0.3s ease;
            border: 2px solid transparent;
        }
        
        .service-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
            border-color: #007bff;
        }
        
        .service-icon {
            font-size: 2.5em;
            margin-bottom: 15px;
        }
        
        .service-name {
            font-size: 1.3em;
            font-weight: bold;
            color: #333;
            margin-bottom: 10px;
        }
        
        .service-desc {
            color: #666;
            font-size: 0.95em;
            margin-bottom: 20px;
        }
        
        .service-link {
            display: inline-block;
            background: #007bff;
            color: white;
            padding: 12px 25px;
            border-radius: 25px;
            text-decoration: none;
            font-weight: bold;
            transition: all 0.3s ease;
        }
        
        .service-link:hover {
            background: #0056b3;
            transform: scale(1.05);
        }
        
        .auto-redirect {
            background: #28a745;
        }
        
        .auto-redirect:hover {
            background: #218838;
        }
        
        .footer {
            text-align: center;
            padding: 25px;
            background: #f8f9fa;
            border-top: 1px solid #eee;
            color: #666;
        }
        
        .last-update {
            font-size: 0.9em;
            margin-top: 10px;
        }
        
        .loading-container {
            text-align: center;
            padding: 60px 30px;
        }
        
        .loading-spinner {
            width: 50px;
            height: 50px;
            border: 5px solid #f3f3f3;
            border-top: 5px solid #007bff;
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin: 0 auto 20px;
        }
        
        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
        
        @media (max-width: 768px) {
            .services-grid {
                grid-template-columns: 1fr;
                padding: 20px;
            }
            
            .header {
                padding: 20px;
            }
            
            .header h1 {
                font-size: 1.8em;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>🖥️ NAS 服务访问中心</h1>
            <p>安全便捷地访问您的家庭网络服务</p>
        </div>
        
        <div class="ip-display">
            <div class="label">当前服务器IP地址</div>
            <div class="ip">123.45.67.89</div>
        </div>

        <div id="services-container">
            <div class="services-grid">
                <div class="service-card">
                    <div class="service-icon">🗄️</div>
                    <div class="service-name">NAS 主服务</div>
                    <div class="service-desc">文件管理、系统监控、套件中心</div>
                    <a href="http://123.45.67.89:5000" class="service-link">访问服务</a>
                </div>
                
                <div class="service-card">
                    <div class="service-icon">🌙</div>
                    <div class="service-name">MoonTV</div>
                    <div class="service-desc">多媒体中心、视频播放、媒体库</div>
                    <a href="http://123.45.67.89:3000" class="service-link">访问服务</a>
                </div>
                
                <div class="service-card">
                    <div class="service-icon">📺</div>
                    <div class="service-name">LibreTV</div>
                    <div class="service-desc">电视直播、节目录制、流媒体</div>
                    <a href="http://123.45.67.89:3100" class="service-link">访问服务</a>
                </div>
                
                <div class="service-card">
                    <div class="service-icon">📡</div>
                    <div class="service-name">IPTV</div>
                    <div class="service-desc">网络电视、频道聚合、实时转播</div>
                    <a href="http://123.45.67.89:3200" class="service-link">访问服务</a>
                </div>
                
                <div class="service-card">
                    <div class="service-icon">🎬</div>
                    <div class="service-name">KateTV</div>
                    <div class="service-desc">电影库、剧集管理、个人影院</div>
                    <a href="http://123.45.67.89:3500" class="service-link">访问服务</a>
                </div>
                
                <div class="service-card">
                    <div class="service-icon">⚡</div>
                    <div class="service-name">自动跳转</div>
                    <div class="service-desc">根据URL参数自动跳转到指定服务</div>
                    <a href="?service=nas" class="service-link auto-redirect">体验自动跳转</a>
                </div>
            </div>
        </div>

        <div class="footer">
            <p>🔒 安全提示：此页面仅用于服务跳转，不会存储任何敏感信息</p>
            <p class="last-update">最后更新: 2024-01-01 12:00:00 | 动态IP自动更新系统</p>
        </div>
    </div>

    <script>
        // 服务配置映射
        const SERVICE_CONFIG = {
            'nas': { port: 5000, name: 'NAS 主服务', icon: '🗄️' },
            'moontv': { port: 3000, name: 'MoonTV', icon: '🌙' },
            'libretv': { port: 3100, name: 'LibreTV', icon: '📺' },
            'iptv': { port: 3200, name: 'IPTV', icon: '📡' },
            'katetv': { port: 3500, name: 'KateTV', icon: '🎬' }
        };

        // 获取URL参数
        function getServiceParam() {
            const params = new URLSearchParams(window.location.search);
            return params.get('service');
        }

        // 执行服务跳转
        function redirectToService(service) {
            const config = SERVICE_CONFIG[service];
            if (!config) {
                console.error('未知的服务类型:', service);
                return false;
            }

            // 显示加载界面
            document.getElementById('services-container').innerHTML = `
                <div class="loading-container">
                    <div class="loading-spinner"></div>
                    <h2>⏳ 正在跳转到 ${config.name}</h2>
                    <p>请稍候，正在连接到服务器...</p>
                    <p>如果页面没有自动跳转，<a href="http://123.45.67.89:${config.port}">请点击这里手动访问</a></p>
                </div>
            `;

            // 3秒后自动跳转
            setTimeout(() => {
                window.location.href = `http://123.45.67.89:${config.port}`;
            }, 3000);

            return true;
        }

        // 页面加载时检查是否需要自动跳转
        const service = getServiceParam();
        if (service) {
            redirectToService(service);
        }

        // 添加键盘快捷键支持
        document.addEventListener('keydown', (e) => {
            // Alt+1 到 Alt+5 快速跳转
            if (e.altKey && e.key >= '1' && e.key <= '5') {
                const services = Object.keys(SERVICE_CONFIG);
                const index = parseInt(e.key) - 1;
                if (index < services.length) {
                    window.location.href = `?service=${services[index]}`;
                }
            }
        });
    </script>
</body>
</html>